package crazy.serializable;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class WriteObject
{
	public static void main(String[] args)
	{
		ObjectOutputStream oos = null;
		try
		{
			oos = new ObjectOutputStream(new FileOutputStream("c:\\x.txt"));
			Person per = new Person("sun wukong", 500);
			oos.writeObject(per);
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		finally
		{
			try
			{ 
				if (oos != null)
				{
					oos.close();
				}
			}
			catch (Exception e2)
			{
				e2.printStackTrace();
			}
		}
	}
}
